// 库存管理接口
import request from "@/common/request.js";
const api = {
  production_plan: "/production_plan/",
  production_order: "/production_order/",
  bom: "/bom/",
  client: "/client/",
  product: "/product/",
  production_plan_mrp: "/production_plan_mrp/",
  purchase_plan: "/purchase_plan/",
  create_production_order: "/create_production_order/",
  staff: "/staff/",
  register_process: "/register_process/",
};

const pOrderApi = {
  get_staff(params) {
    return request({
      url: api.staff,
      method: "get",
      params,
    });
  },

  get_client(params) {
    return request({
      url: api.client,
      method: "get",
      params,
    });
  },

  get_product(params) {
    return request({
      url: api.product,
      method: "get",
      params,
    });
  },
  get_production_order(params) {
    return request({
      url: api.production_order,
      method: "get",
      params,
    });
  },

  production_order_detail(id) {
    return request({
      url: api.production_order + id,
      method: "get",
    });
  },

  get_bom(params) {
    return request({
      url: api.bom,
      method: "get",
      params,
    });
  },

  post_register_process(data) {
    return request({
      url: api.register_process,
      method: "post",
      data,
    });
  },

  post_production_plan_mrp(data) {
    return request({
      url: api.production_plan_mrp,
      method: "post",
      data,
    });
  },

  create_production_order(data) {
    return request({
      url: api.create_production_order,
      method: "post",
      data,
    });
  },

  post_production_order(data) {
    return request({
      url: api.production_order,
      method: "post",
      data,
    });
  },

  patch_production_order(data, id) {
    return request({
      url: api.production_order + id + "/",
      method: "patch",
      data,
    });
  },

  delete_production_order(id) {
    return request({
      url: api.production_order + id + "/",
      method: "delete",
    });
  },
};
export default pOrderApi;
